#ifndef QRCODEGENERATE_H
#define QRCODEGENERATE_H

#include <QWidget>
#include "qrencode.h"
#include <QPainter>


class QrcodeGenerate : public QWidget
{
    Q_OBJECT

public:
    explicit QrcodeGenerate(QWidget *parent = 0);
    ~QrcodeGenerate();
    void generateString(QString str);
    bool saveImage(QString fileName, int size=250);
    bool serialCompare(QString _serial) { return (prvSerial_ == _serial); }
private:
    void draw(QPainter &painter, int width, int height);
    QString string;
    QRcode *qr;

protected:
    void paintEvent(QPaintEvent *);
    QSize sizeHint() const;
    QSize minimumSizeHint() const;

private:
    // 序列号
    QString prvSerial_;

};

#endif // QRCODEGENERATE_H
